﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "个人中心";
       
        scjrm.WebServiceGZ Web = new scjrm.WebServiceGZ();
        if (Session["UID"] != null)
        {
            string UID = Session["UID"].ToString();
            string YGBH = Session["ygbh"].ToString();
            string XINGMING = Session["xingming"].ToString();
            string DepartmentName = Session["DepartmentName"].ToString();
            string AppointmentName = Session["AppointmentName"].ToString();
            string rsjbqyshj = Session["rsjbqyshj"].ToString();
            string gl = Session["gl"].ToString();
            string state = Session["state"].ToString();
            string ZJM = Session["zjm"].ToString();
            string KL = Session["kl"].ToString();
            string Photo = Session["Photo"].ToString();
            if (KL == "202CB962AC59075B964B07152D234B70")
            {
                Response.Redirect("Repass.aspx");
            }
            UserName.Text = XINGMING;
            Department.Text = DepartmentName;
            Appointment.Text = AppointmentName;
            employed.Text = gl + "年（" + rsjbqyshj + "）";
            Photos.ImageUrl = Photo;

            string GetNote = Web.GetUserAtt("shensoft", YGBH);
            string[] NoteArray = GetNote.Split('|');
            nxjts.Text = NoteArray[0].ToString() + "/" + NoteArray[1].ToString();
            sjts.Text = NoteArray[2].ToString();
            bjts.Text = NoteArray[3].ToString();
            kgts.Text = NoteArray[4].ToString();

            AttInfo.Text = "年休假请在" + NoteArray[6].ToString() + "~" + NoteArray[7].ToString()+"前休完";

            string NotifyInfoEx = "";
            DataSet GetNotifyInfo = Web.GetNotifyList("shensoft", 5);
            for (int w = 0; w < GetNotifyInfo.Tables[0].Rows.Count; w++)
            {
                //将日期字符串转换为日期对象
                DateTime t1 = Convert.ToDateTime(GetNotifyInfo.Tables[0].Rows[w][5]);
                DateTime t2 = DateTime.Now.AddDays(-15);
                //通过DateTIme.Compare()进行比较（）
                int compNum = DateTime.Compare(t1, t2);
                if (compNum > 0)
                {
                    NotifyInfoEx += "<li>\r\n" +
                        "    <dl>\r\n" +
                        "        <dt>" + GetNotifyInfo.Tables[0].Rows[w][2].ToString() + " " + GetNotifyInfo.Tables[0].Rows[w][5].ToString().Substring(0, 10) + "</dt>" +
                        "        <dd>" + GetNotifyInfo.Tables[0].Rows[w][6].ToString() + "</dd>\r\n" +
                        "    </dl>\r\n" +
                        "</li>\r\n";
                }
            }

            this.NotifyInfo.Text = NotifyInfoEx;
            if (YGBH == "11")
            {
                this.Literal1.Text = "<div class=\"psn-sign-cmn\">\r\n"
                           + " <a href=\"Drug.aspx\">\r\n"
                           + " <i class=\"btn-bg icon04\"></i>\r\n"
                           + " <i class=\"btn-bg icon02\"></i>\r\n"
                           + " <span class=\"sign-ft\">商品库存</span>\r\n"
                           + " </a>\r\n"
                           + " </div>\r\n";
            }
        }

        else
        {
            Session.Abandon();
            //清空
            Session.Clear();
            Response.Redirect("Login.aspx");
        }
    }

}
